package com.online.usermanagesystem.controller;

import com.online.usermanagesystem.service.SessionManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 会话管理控制器
 *
 * @author jhk
 * @create 2018-04-24 11:10
 */
@RestController
@RequestMapping(value = "/session")
public class SessionManageController {

    @Autowired
    private SessionManageService sessionManageService;

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public Object login(String name, String password) {
        return sessionManageService.login(name, password);
    }

    @RequestMapping(value = "/logout", method = RequestMethod.GET)
    public Object logout(String token) {
        return sessionManageService.logout(token);
    }

    @RequestMapping(value = "/find", method = RequestMethod.GET)
    public Object valid(String token) {
        return sessionManageService.find(token);
    }
}
